-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Test:nit incremental bulk missing content #133855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertThrows returns the exception it caught, so you can just do this:
assertEquals(
"request body is required",
assertThrows(
ElasticsearchParseException.class,
() -> new RestBulkAction(
Settings.EMPTY,
ClusterSettings.createBuiltInClusterSettings(),
new IncrementalBulkService(mock(Client.class), mock(IndexingPressure.class), MeterRegistry.NOOP)
).handleRequest(
new FakeRestRequest.Builder(xContentRegistry()).withPath("my_index/_bulk")
.withContentLength(0)
.withBody(new FakeHttpBodyStream())
.build(),
mock(RestChannel.class),
mock(NodeClient.class)
)
).getMessage()
);There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (slight preference for keeping assertThrows, see previous comment, but it doesn't matter much either way)
Ah, I love to read code starting from both ends towards centre, especially when flip monitor 90 degrees and slowly cross eyes. ꩜ |
|
Hehe just be glad the callbacks don't go backwards... |
Adding assertion on exception message for missing content in incremental bulk test.
#133685 (comment)